{% extends 'base.html' %}
{% load staticfiles %}

{% block CSS %}
    <link href="{% static 'css/plugins/datapicker/bootstrap-datepicker.css' %}" type="text/css" rel="stylesheet">
    <link href="{% static "css/bootstrap.min.css" %}" rel="stylesheet">
    <link href="{% static "font-awesome/css/font-awesome.css" %}" rel="stylesheet">
    <link href="{% static "css/animate.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/codemirror/codemirror.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/codemirror/ambiance.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/jQueryUI/jquery-ui-1.10.4.custom.min.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/chosen/chosen.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/dropzone/dropzone.css" %}" rel="stylesheet">
    <link href="{% static "css/plugins/jqGrid/ui.jqgrid.css" %}" rel="stylesheet" type="text/css">
    <link href="{% static "css/style.css" %}" rel="stylesheet">

    <script src="{% static "js/jquery-2.1.1.js" %}"></script>
    <script src="{% static "js/bootstrap.min.js" %}"></script>
{% endblock %}

{% block contxt %}
     <div class="row  border-bottom white-bg page-heading">
        <div class="col-lg-12" align="left">
            <button id="addBtn" type="button" class="btn btn-w-m btn-primary">增加</button>
            <button type="button" class="btn btn-w-m btn-info" id="editBtn" >编辑</button>
            <button type="button" class="btn btn-w-m btn-danger" id="delBtn">删除</button>
        </div>
        <div align="right">
             <label for="">日期:  &nbsp;</label>
             <input type="text"  name="start" placeholder="起始日期" id="start-picker" readonly value="{{ sdate }}">
            <span>--</span>
            <input type="text"  name="end" placeholder="结束日期" id="end-picker" readonly value="{{ edate }}">
            <button type="button" class="btn btn-w-m btn-success" id="btnQuery" onclick="btn_sel()">查询</button>
            </div>
    </div>
    <div class="fh-breadcrumb">
        <div class="full-height">
            <div class="full-height-scroll white-bg ">
                <div class="element-detail-box">
                    <div class="ibox-content">
                        <div class="jqGrid_wrapper">
                            <form action="http://apit.icibei.com/order-service/order/external/acceptReceiptItems" method="POST">
                            {% csrf_token %}
                                <!--onclick="post_data()"-->
                            <input type="submit" id="btnOK"  value="提交">
                            </form>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block Message %}

	<div id="ycf-alert" class="modal">
		<div class="modal-dialog modal-sm">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
					<h5 class="modal-title"><i class="fa fa-exclamation-circle"></i> [Title]</h5>
				</div>
				<div class="modal-body small">
					<p>[Message]</p>
				</div>
				<div class="modal-footer" >
					<button type="button" class="btn btn-primary ok" data-dismiss="modal">[BtnOk]</button>
					<button type="button" class="btn btn-default cancel" data-dismiss="modal">[BtnCancel]</button>
				</div>
			</div>
		</div>
	</div>
{% endblock %}

{% block script %}
     <!-- Mainly scripts -->

    <script src="{% static "js/plugins/metisMenu/jquery.metisMenu.js" %}"></script>
    <script src="{% static "js/plugins/slimscroll/jquery.slimscroll.min.js" %}"></script>

    <!-- Custom and plugin javascript -->
    <script src="{% static "js/inspinia.js" %}"></script>
    <script src="{% static "js/plugins/pace/pace.min.js" %}"></script>

    <!-- Peity -->
    <script src="{% static "js/plugins/peity/jquery.peity.min.js" %}"></script>
    <script src="{% static "js/plugins/chosen/chosen.jquery.js" %}"></script>
    <!--日期控件-->
    <script src="{% static "js/plugins/datapicker/bootstrap-datepicker.js" %}"></script>
	<script src="{% static 'js/plugins/datapicker/bootstrap-datepicker.min.js' %}" type="text/javascript"></script>
	<script src="{% static 'js/plugins/datapicker/bootstrap-datepicker.zh-CN.min.js' %}" type="text/javascript"></script>
	<script src="{% static 'js/DateCtrl.js' %}" type="text/javascript"></script>
    <script src="{% static "js/myjs/mytools.js" %}" ></script>
    <!-- jqGrid -->
    <script src="{% static "js/plugins/jqGrid/grid.locale-en.js" %}"></script>
    <script src="{% static "js/plugins/jqGrid/jquery.jqGrid.min.js" %}"></script>
    <!--
    <script src="{% static "js/plugins/jquery-ui/jquery-ui.min.js"%}"></script>
    -->
<script type="text/javascript">
    $(document).ready(function () {
        var url = window.location.pathname;
        if(url != "/" && url != "/index/"){
            $("li").removeClass("active");
            $("[href*='" + url + "']").parent().parent().parent().addClass("active");
            $("[href*='" + url + "']").parent().parent().addClass("in");
            $("[href*='" + url + "']").parent().addClass("active");
            //alert(url);
        }

        window.Modal = function () {
            var reg = new RegExp("\\[([^\\[\\]]*?)\\]", 'igm');
            var alr = $("#ycf-alert");
            var ahtml = alr.html();
            //alert(ahtml);

            /* html 复原不在 _init() 里面做了，重复调用时会有问题，直接在 _alert/_confirm 里面做 */
            var _alert = function (options) {
                alr.html(ahtml);	// 复原
                alr.find('.ok').removeClass('btn-success').addClass('btn-primary');
                alr.find('.cancel').hide();
                _dialog(options);

                return {
                    on: function (callback) {
                        if (callback && callback instanceof Function) {
                            alr.find('.ok').click(function () { callback(true) });
                        }
                    }
                };
            };

            var _confirm = function (options) {
                alr.html(ahtml); // 复原
                alr.find('.ok').removeClass('btn-primary').addClass('btn-success');
                alr.find('.cancel').show();
                _dialog(options);

                return {
                    on: function (callback) {
                        if (callback && callback instanceof Function) {
                            alr.find('.ok').click(function () { callback(true) });
                            alr.find('.cancel').click(function () { callback(false) });
                        }
                    }
                };
            };

            var _dialog = function (options) {
                var ops = {
                    msg: "提示内容",
                    title: "操作提示",
                    btnok: "确定",
                    btncl: "取消"
                };

                $.extend(ops, options);

                console.log(alr);

                var html = alr.html().replace(reg, function (node, key) {
                    return {
                        Title: ops.title,
                        Message: ops.msg,
                        BtnOk: ops.btnok,
                        BtnCancel: ops.btncl
                    }[key];
                });

                alr.html(html);
                alr.modal({
                    width: 500,
                    backdrop: 'static'
                });
            }

            return {
                alert: _alert,
                confirm: _confirm
            }

        }();

    })

</script>

{% endblock %}